import request from '@/utils/request'

// 获取员工列表
export function getEmployeeList(params) {
  return request({
    url: '/emps',
    method: 'get',
    params
  })
}

// 删除员工
export function deleteEmployee(id) {
  return request({
    url: `/emps/${id}`,
    method: 'delete'
  })
}

// 批量删除员工
export function batchDeleteEmployees(ids) {
  return request({
    url: '/emps/batch',
    method: 'delete',
    data: { ids }
  })
}

// 添加员工
export function addEmployee(data) {
  return request({
    url: '/emps',
    method: 'post',
    data
  })
}

// 根据ID查询员工
export function getEmployeeById(id) {
  return request({
    url: `/emps/${id}`,
    method: 'get'
  })
}

// 修改员工
export function updateEmployee(data) {
  return request({
    url: '/emps',
    method: 'put',
    data
  })
}

// 上传头像
export function uploadAvatar(file) {
  const formData = new FormData()
  formData.append('file', file)
  return request({
    url: '/emps/avatar',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
} 